/**
 * Licensed Materials - Property of IBM
 * (c) Copyright IBM Corporation 2008. All Rights Reserved.
 * 
 * Note to U.S. Government Users Restricted Rights:
 * Use, duplication or disclosure restricted by GSA ADP Schedule
 * Contract with IBM Corp.
 *
 * $Id$
 */
package it.uniba.di.collab.jazzfeed.common.model.impl;

import com.ibm.team.repository.common.model.impl.SimpleItemImpl;

import it.uniba.di.collab.jazzfeed.common.model.JazzfeedPackage;
import it.uniba.di.collab.jazzfeed.common.model.Room;
import it.uniba.di.collab.jazzfeed.common.model.RoomHandle;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Room</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link it.uniba.di.collab.jazzfeed.common.model.impl.RoomImpl#getNome <em>Nome</em>}</li>
 *   <li>{@link it.uniba.di.collab.jazzfeed.common.model.impl.RoomImpl#getUrl <em>Url</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class RoomImpl extends SimpleItemImpl implements Room {
	/**
	 * A set of bit flags representing the values of boolean attributes and whether unsettable features have been set.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 * @ordered
	 */
	protected int ALL_FLAGS = 0;

	/**
	 * The default value of the '{@link #getNome() <em>Nome</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNome()
	 * @generated
	 * @ordered
	 */
	protected static final String NOME_EDEFAULT = "JazzFeed"; //$NON-NLS-1$

	/**
	 * The cached value of the '{@link #getNome() <em>Nome</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNome()
	 * @generated
	 * @ordered
	 */
	protected String nome = NOME_EDEFAULT;

	/**
	 * The flag representing whether the Nome attribute has been set.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 * @ordered
	 */
	protected static final int NOME_ESETFLAG = 1 << 10;

	/**
	 * The default value of the '{@link #getUrl() <em>Url</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getUrl()
	 * @generated
	 * @ordered
	 */
	protected static final String URL_EDEFAULT = "http://www.friendfeed.com/rooms/jazzfeed"; //$NON-NLS-1$

	/**
	 * The cached value of the '{@link #getUrl() <em>Url</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getUrl()
	 * @generated
	 * @ordered
	 */
	protected String url = URL_EDEFAULT;

	/**
	 * The flag representing whether the Url attribute has been set.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 * @ordered
	 */
	protected static final int URL_ESETFLAG = 1 << 11;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private static final int EOFFSET_CORRECTION = JazzfeedPackage.Literals.ROOM
			.getFeatureID(JazzfeedPackage.Literals.ROOM__NOME)
			- JazzfeedPackage.ROOM__NOME;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected RoomImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected EClass eStaticClass() {
		return JazzfeedPackage.Literals.ROOM;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getNome() {
		return nome;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setNome(String newNome) {
		String oldNome = nome;
		nome = newNome;
		boolean oldNomeESet = (ALL_FLAGS & NOME_ESETFLAG) != 0;
		ALL_FLAGS |= NOME_ESETFLAG;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET,
					JazzfeedPackage.ROOM__NOME + EOFFSET_CORRECTION, oldNome,
					nome, !oldNomeESet));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void unsetNome() {
		String oldNome = nome;
		boolean oldNomeESet = (ALL_FLAGS & NOME_ESETFLAG) != 0;
		nome = NOME_EDEFAULT;
		ALL_FLAGS &= ~NOME_ESETFLAG;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.UNSET,
					JazzfeedPackage.ROOM__NOME + EOFFSET_CORRECTION, oldNome,
					NOME_EDEFAULT, oldNomeESet));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean isSetNome() {
		return (ALL_FLAGS & NOME_ESETFLAG) != 0;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getUrl() {
		return url;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setUrl(String newUrl) {
		String oldUrl = url;
		url = newUrl;
		boolean oldUrlESet = (ALL_FLAGS & URL_ESETFLAG) != 0;
		ALL_FLAGS |= URL_ESETFLAG;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET,
					JazzfeedPackage.ROOM__URL + EOFFSET_CORRECTION, oldUrl,
					url, !oldUrlESet));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void unsetUrl() {
		String oldUrl = url;
		boolean oldUrlESet = (ALL_FLAGS & URL_ESETFLAG) != 0;
		url = URL_EDEFAULT;
		ALL_FLAGS &= ~URL_ESETFLAG;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.UNSET,
					JazzfeedPackage.ROOM__URL + EOFFSET_CORRECTION, oldUrl,
					URL_EDEFAULT, oldUrlESet));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean isSetUrl() {
		return (ALL_FLAGS & URL_ESETFLAG) != 0;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID - EOFFSET_CORRECTION) {
		case JazzfeedPackage.ROOM__NOME:
			return getNome();
		case JazzfeedPackage.ROOM__URL:
			return getUrl();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eSet(int featureID, Object newValue) {
		switch (featureID - EOFFSET_CORRECTION) {
		case JazzfeedPackage.ROOM__NOME:
			setNome((String) newValue);
			return;
		case JazzfeedPackage.ROOM__URL:
			setUrl((String) newValue);
			return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eUnset(int featureID) {
		switch (featureID - EOFFSET_CORRECTION) {
		case JazzfeedPackage.ROOM__NOME:
			unsetNome();
			return;
		case JazzfeedPackage.ROOM__URL:
			unsetUrl();
			return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean eIsSet(int featureID) {
		switch (featureID - EOFFSET_CORRECTION) {
		case JazzfeedPackage.ROOM__NOME:
			return isSetNome();
		case JazzfeedPackage.ROOM__URL:
			return isSetUrl();
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int eDerivedStructuralFeatureID(int baseFeatureID, Class baseClass) {
		if (baseClass == RoomHandle.class) {
			switch (baseFeatureID) {
			default:
				return -1;
			}
		}
		if (baseClass == Room.class) {
			switch (baseFeatureID - EOFFSET_CORRECTION) {
			case JazzfeedPackage.ROOM__NOME:
				return JazzfeedPackage.ROOM__NOME + EOFFSET_CORRECTION;
			case JazzfeedPackage.ROOM__URL:
				return JazzfeedPackage.ROOM__URL + EOFFSET_CORRECTION;
			default:
				return -1;
			}
		}
		return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String toString() {
		if (eIsProxy())
			return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (nome: "); //$NON-NLS-1$
		if ((ALL_FLAGS & NOME_ESETFLAG) != 0)
			result.append(nome);
		else
			result.append("<unset>"); //$NON-NLS-1$
		result.append(", url: "); //$NON-NLS-1$
		if ((ALL_FLAGS & URL_ESETFLAG) != 0)
			result.append(url);
		else
			result.append("<unset>"); //$NON-NLS-1$
		result.append(')');
		return result.toString();
	}

} //RoomImpl
